<template>
  <div>
    <a-form-model-item label="用户ID">
      <a-input v-model="form.id" placeholder="请输入要修改的用户ID" />
    </a-form-model-item>
    <a-form-model-item :wrapper-col="buttonItemLayout.wrapperCol">

      <a-form-model-item label="用户名">
        <a-input v-model="form.username" placeholder="请输入修改后的用户名" />
      </a-form-model-item>

      <a-form-model-item label="密码">
        <a-input v-model="form.password" placeholder="请输入修改后的密码" />
      </a-form-model-item>

      <a-button @click="put">
        修&emsp;改
      </a-button>

    </a-form-model-item>

  </div>

</template>

<script>
export default {
name: "update_user",
  data(){
  return{
    form:{
      id:'',
      username: "",
      password: "",
    }
  }
  },
  computed:{
    buttonItemLayout() {
      const { layout } = this.form;
      return layout === "horizontal"
        ? {
          wrapperCol: { span: 14, offset: 4 },
        }
        : {};
    },
  },
  methods:{
  put(){
    console.log(this.form.id)
    console.log(this.form.username)
    console.log(this.form.password)
    // this.$axios.put('/z/user/?id='+this.id+'&username='+this.username+'&password='+this.password)
    this.$axios.put("/z/user/?id="+this.form.id, {
      username: this.form.username,
      password: this.form.password
    })
    .then(res=>{
      alert(res.data.msg)
      console.log(res.data)
    })
  }
  }
}
</script>

<style scoped>

</style>
